USE [AdventureWorksLT]
GO

/****** Object:  StoredProcedure [dbo].[INSERT_ADDRESS]    Script Date: 04/29/2012 23:45:50 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[INSERT_ADDRESS]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[INSERT_ADDRESS]
GO

USE [AdventureWorksLT]
GO

/****** Object:  StoredProcedure [dbo].[INSERT_ADDRESS]    Script Date: 04/29/2012 23:45:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<River Li>
-- Create date: <2012-04-29>
-- Description:	<INSERT a record>
-- =============================================
CREATE PROCEDURE [dbo].[INSERT_ADDRESS] 
   @AddressLine1 nvarchar(60)
   ,@AddressLine2 nvarchar(60)
   ,@City nvarchar(30)
   ,@StateProvince Name
   ,@CountryRegion Name
   ,@PostalCode nvarchar(15)
   ,@rowguid uniqueidentifier
   ,@ModifiedDate datetime
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	INSERT INTO [AdventureWorksLT].[SalesLT].[Address]
			   ([AddressLine1]
			   ,[AddressLine2]
			   ,[City]
			   ,[StateProvince]
			   ,[CountryRegion]
			   ,[PostalCode]
			   ,[rowguid]
			   ,[ModifiedDate])
		 VALUES
			   (@AddressLine1
			   ,@AddressLine2
			   ,@City
			   ,@StateProvince
			   ,@CountryRegion
			   ,@PostalCode
			   ,@rowguid
			   ,@ModifiedDate)

	SELECT SCOPE_IDENTITY() as ID

END

GO

